/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package rs.fon.rapidminer.gui.util;

import java.util.Iterator;
import java.util.List;

/**
 * Class that provides some neat tools.
 *
 * @author Sasa
 */
public class Helper {
    
    /**
     * Turns an array of objects to an array of classes.
     * It is assumed that objects represent string for which the 
     * classes can be created using the <code>Class.forName(String class)</code> method.
     * @param objects objects to convert
     * @return an array of classes
     * @throws java.lang.ClassNotFoundException if class cannot be created for a certain string,  that is object
     */
    
    public static Class[] objectsToClasses(Object[] objects) throws ClassNotFoundException{        
        Class[] classes=new Class[objects.length];        
        for(int i=0; i<objects.length; i++ ){
            classes[i]=Class.forName((String)objects[i]);
        }
        return classes;
    }    
    
    /**
     * Empties a list of elements
     * @param list
     * @return empty list
     */
    public static List<?> cleanList(List<?> list){        
        for(int i=0; i<list.size(); i++){
            list.remove(i);
        }
        return list;
    }    

}
